package top.lixunda.ecommerce.server.user.api.entity.dto;

import lombok.Data;
import lombok.EqualsAndHashCode;
import top.lixunda.ecommerce.server.user.api.entity.db.BindingTypeDO;
import top.lixunda.common.validate.annotation.XumBetween;
import top.lixunda.common.validate.annotation.XumIncludes;
import top.lixunda.common.validate.annotation.XumNotNull;

/**
 * @author Xumda
 * @version time:2019/12/13 16:06
 * <p>
 * 通过token进行登录
 */
@Data
@EqualsAndHashCode(callSuper = false)
@SuppressWarnings("WeakerAccess")
public class LoginTokenDTO {

    /**
     * 邮箱登陆 4
     */
    public static final int TYPE_EMAIL = BindingTypeDO.BINDING_TYPE_EMAIL;

    /**
     * 手机号码登陆 5
     */
    public static final int TYPE_PHONE = BindingTypeDO.BINDING_TYPE_PHONE;

    /**
     * 身份证号码登陆 6
     */
    public static final int TYPE_ID_CARD = BindingTypeDO.BINDING_TYPE_ID_CARD;

    /**
     * 登陆类型，见常量
     */
    @XumNotNull
    @XumIncludes(numbers = {TYPE_EMAIL, TYPE_PHONE, TYPE_ID_CARD})
    private Integer type;

    /**
     * 用户名，可以是邮箱，手机，身份证号
     */
    @XumNotNull
    @XumBetween(min = 6, max = 32)
    private String username;

    /**
     * token
     */
    @XumNotNull
    private String token;

}
